<template>
	<view class="bigView">
		<view class="topView">
			<!-- <view class="title">瑞幸错过了杀死库迪的最好时机</view>
			<view class="subTitle">2024-07-12 由小胡发布</view>
			<div v-html="htmlValue" style="margin-top: 20px;margin-left: 12px;"></div> -->
			<view style="width: 100vw;height: 200px;background-color: #FFFFFF;margin-top: 8px;">
				<u--textarea maxlength="1000" height="200" style="background-color: red;" :confirmType="null" v-model="value" placeholder="请输入内容" type="textarea" />
			</view>
			
		</view>
		<view class="bottomView" :style="[{height:bottom + 'px'}]">
			<view class="sure" @click="sureHandle">提交</view>
		</view>
	</view>
</template>

<script>
	import { isJZNull } from '../../../utils/auth';
import mine from '@/api/mine.js'
	export default{
		components:{
			
		},
		data(){
			return {
				border: true,
				bottom:0,
				userInfo:{},
				value:'',
			}
		},
		mounted() {
			uni.getSystemInfo({success: (e) => {
				// this.StatusBar = e.statusBarHeight;
				let custom = wx.getMenuButtonBoundingClientRect();
				this.bottom = custom.bottom;
				// this.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
				// this.TopHeight = this.CustomBar+100;//this.StatusBar+this.CustomBar;
			}})
		},
		onShow() {
			this.$nextTick(() =>{
				this.initUserInfo()
			})
		},
		methods:{
			initUserInfo(){
				const userInfo = uni.getStorageSync("userInfo")
				if(userInfo){
					this.userInfo = JSON.parse(userInfo)
				}
			},
			sureHandle(){
				if (isJZNull(this.value)) {
					uni.showToast({
						icon:"none",
						title:"请输入内容"
					})
					return;
				}
				if (Object.keys(this.userInfo).length==0) {
					uni.showToast({
						icon:"none",
						title:"请先登录",
						complete() {
							setTimeout(()=>{
								uni.reLaunch({
									url:'/pages/login/login'
								})
							},500)
						}
					})
					return;
				}
				uni.showLoading({
					title:"正在提交..."
				})
				mine.saveFeedback({
					opinionDescription:this.value,
					userId:this.userInfo.id
				}).then(res =>{
					uni.hideLoading()
					uni.showToast({
						icon:'none',
						title:"反馈成功",
						complete() {
							setTimeout(()=>{
								uni.navigateBack()
							},500)
						}
					})
					
				}).catch(error =>{
					uni.hideLoading()
				})
			}
		},
		onReady() {
			
		}
	}
</script>

<style lang="scss" scoped>
.bigView{
	width: 100vw;
	height: 100vh;
	background-color: #F7F7F7;
	display: flex;
	flex-direction: column;
	// align-items: center;
	// justify-content: center;
}
.topView{
	flex-grow: 1;
	// width: 100vw;
	// background-color: green;
	display: flex;
	flex-direction: column;
	width: 100vw;
	// justify-content: center;
	.title{
		font-size: 20px;
		color: #000000;
		margin-top: 24px;
		margin-left: 16px;
	}
	.subTitle{
		font-size: 12px;
		color: #7E7E7E;
		margin-top: 8px;
		margin-left: 16px;
	}
}

.bottomView{
	height: 150px;
	width: 100vw;
	// background-color: yellow;
	display: flex;
	justify-content: center;
	.sure{
		width: calc(100vw - 32px);//calc(100vw-#{32px});
		height: 48px;
		border-radius: 24px;
		background-color: #247BFD;
		display: flex;
		align-items: center;
		justify-content: center;
		color: white;
	}
}
</style>